这是一个可设置时间的关机小程序
<script language="VBScript">
Sub Window_onLoad
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 900) / 2
intTop = (intVertical - 700) / 2
window.resizeTo 350,500
window.moveTo intLeft, intTop
End Sub
Sub OneSub
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -f -t 1800", 0, TRUE)
End Sub
Sub TwoSub
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -f -t 2700", 0, TRUE)
End Sub
Sub ThrSub
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -f -t 3600", 0, TRUE)
End Sub
Sub fouSub
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -f -t 10", 0, TRUE)
End Sub
Sub OK
If IsNumeric(Text.Value) Then
OverTime = Text.Value * 60
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -f -t " & OverTime, 0, TRUE)
Else
MsgBox "请输入一个有效的数字。"
End If
End Sub
Sub ShutDown
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -s -t 0", 0, TRUE)
End Sub
Sub EShutDown
set objectShell=CreateObject("wscript.shell")
iReturn = objectShell.Run("shutdown -a", 0, TRUE)
End Sub
评论